#include <cstdio>
#include <cstring>

long long F(int num);

int main(int argc, char const *argv[]) {
    int n;
    while (scanf("%d", &n) != EOF)
        printf("%d\n", F(n));
    return 0;
}

long long F(int num) {
    if (num == 1)
        return 2;
    else
        return 3 * F(num - 1) + 2;
}